<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
    <style>
        .box{
            margin-top:20px;
            margin-bottom:10px;
        }
        .required_text{
            color:red;
            padding: 8px;
        }
    </style>
</head>
<body>

<div style="padding: 20px; background-color: #F2F2F2;">
    <div class="layui-row layui-col-space15">
        <!--标品名称-->
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">
                    <h2>1、配置标品</h2>
                </div>
                <div class="layui-card-body">
                    <div class="box">
                        <div style="margin-left:20px;">
                            <form class="layui-form" id="standardForm">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">标品名称</label>
                                    <div class="layui-input-inline" style="width:70%">
                                        {if !empty($product_name) && $product_name!==''}
                                        <input id="standardNmae" name="name" lay-verify="required" value="{$product_name}" placeholder="请输入名称" autocomplete="off" class="layui-input" type="text">
                                        {else}
                                        <input id="standardNmae" name="name" lay-verify="required" {notempty name="$info.name"}value="{$info.name}"{/notempty} placeholder="请输入名称" autocomplete="off" class="layui-input" type="text">
                                        {/if}
                                    </div>
                                </div>
                                <input type="hidden" name="page_index" value="2">
                                <input type="hidden" id="standard_id" name="id" {notempty name='$info'}value="{$info.id}"{/notempty}>
                                <input type="hidden" id="product_id" name="product_id" {notempty name='$product_id'}value="{$product_id}"{/notempty}>

                                <div class="layui-form-item">
                                    <div class="layui-input-block">
                                        <button class="layui-btn layui-btn-radius" lay-submit lay-filter="standardForm">下一页</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<script src="__PUBLIC__/layui/layui.js"></script>
<script src="__PUBLIC__/jquery/jquery.min.js"></script>
<script>
    layui.use(['element','layer', 'form'], function() {
        var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form;
        //***************************************************************************
        //名称提交
        form.on('submit(standardForm)', function() {
            var id = $("#standard_id").val();
            $.ajax({
                url:"{:url('admin/standard/submitTitle')}",
                data:$('#standardForm').serialize(),
                type:'post',
                async: false,
                success:function(res) {
                    layer.msg(res.msg);
                    if(res.code == 1) {
                        setTimeout(function(){
                            location.href = "{:url('admin/standard/process')}?id="+res.data.id;
                        },1500);
                    }
                    return false;
                }
            });
            return false;
        });
    });
</script>

</body>
</html>
